package com.lemon.blog.web.controller;

import com.lemon.blog.web.domain.BlTag;
import com.lemon.blog.web.service.IBlTagService;
import com.lemon.common.core.web.controller.BaseController;
import com.lemon.common.core.web.domain.AjaxResult;
import com.lemon.common.core.web.page.TableDataInfo;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;

/**
 * 包名称：com.lemon.blog.controller
 * 类名称：BlTagController
 * 类描述：标签管理Controller
 * 创建人：@author huangpeng
 * 创建时间：2022-05-04
 */
@Api("标签信息")
@RestController
@RequestMapping("/tag")
public class BlTagController extends BaseController {
    @Autowired
    private IBlTagService blTagService;

    /**
     * 查询标签管理列表
     * @Title: list
     * @Description: 查询标签管理列表
     * @param blTag
     * @return: TableDataInfo
     * @throws:
     * @author: huangpeng
     * @Date: 2023/4/30 22:12
     */
    @GetMapping("/list")
    public TableDataInfo list(BlTag blTag) {
        startPage();
        List<BlTag> list = blTagService.selectBlTagList(blTag);
        return getDataTable(list);
    }

    /**
     * 获取标签管理详细信息
     * @Title: getInfo
     * @Description: 获取标签管理详细信息
     * @param tagId
     * @return: AjaxResult
     * @throws:
     * @author: huangpeng
     * @Date: 2023/4/30 22:13
     */
    @GetMapping(value = "/{tagId}")
    public AjaxResult getInfo(@PathVariable("tagId") Long tagId) {
        return AjaxResult.success(blTagService.selectByPrimaryKey(tagId));
    }

    /**
     * @Title: queryAllTag
     * @Description: 获取所有标签信息
     * @param
     * @return: AjaxResult
     * @throws:
     * @author: huangpeng
     * @Date: 2022/4/30 0:32
     */
    @GetMapping("/queryAll")
    public AjaxResult queryAllTag() {
        return AjaxResult.success(blTagService.queryAllTag());
    }
}
